package cn.itcast.service.cargo.impl;


import cn.itcast.dao.cargo.FinanceDao;
import cn.itcast.domain.cargo.Finance;
import cn.itcast.domain.cargo.FinanceExample;
import cn.itcast.domain.vo.FinanceVo;
import cn.itcast.service.cargo.FinanceService;
import cn.itcast.utils.UUIDUtils;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class FinanceServiceImpl implements FinanceService {
    @Autowired
    private FinanceDao financeDao;

    @Override
    public Finance findById(String id) {
        return financeDao.selectByPrimaryKey(id);
    }

    @Override
    public void save(Finance finance) {
        finance.setFinanceId(UUIDUtils.getId());
        financeDao.insert(finance);
    }

    @Override
    public void update(Finance finance) {

    }

    @Override
    public void delete(String id) {

    }

    @Override
    public PageInfo findByPage(int page, int size, FinanceExample example) {
        PageHelper.startPage(page,size);
        List<Finance> financeList = financeDao.selectByExample(example);
        return new PageInfo(financeList);
    }

    @Override
    public List<Finance> findAll(FinanceExample financeExample) {
        return null;
    }

    @Override
    public FinanceVo findFinanceVoById(String financeId) {
        return financeDao.findFinanceVoById(financeId);
    }
}
